package com.A1908.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/*服务器内部转发处理*/
@WebServlet(urlPatterns = {"/forward"})
public class ForwardServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String opr = request.getParameter("opr");

        if ("main".equals(opr)){
            request.getRequestDispatcher("WEB-INF/main.jsp").forward(request,response);
        }else if ("home".equals(opr)){
            request.getRequestDispatcher("WEB-INF/home.jsp").forward(request,response);
        }else if ("feastList".equals(opr)){
            request.getRequestDispatcher("WEB-INF/feastList.jsp").forward(request,response);
        }else if ("addfeast".equals(opr)){
            request.getRequestDispatcher("WEB-INF/addFeast.jsp").forward(request,response);
        }else if ("userInfo".equals(opr)){
            request.getRequestDispatcher("WEB-INF/userInfo.jsp").forward(request,response);
        }else if ("attendpeople".equals(opr)){
            request.getRequestDispatcher("WEB-INF/addAttendPeople.jsp").forward(request,response);
        }else if ("myAttend".equals(opr)){
            request.getRequestDispatcher("WEB-INF/myAttend.jsp").forward(request,response);
        }else if ("updatePwd".equals(opr)){
            request.getRequestDispatcher("WEB-INF/updatePwd.jsp").forward(request,response);
        }else if ("giftMore".equals(opr)){
            request.getRequestDispatcher("WEB-INF/giftMore.jsp").forward(request,response);
        }else if ("giftAnalysis".equals(opr)){
            request.getRequestDispatcher("WEB-INF/giftAnalysis.jsp").forward(request,response);
        }
    }
}
